home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
UTIL
/
SYS
/
LOADER
/
!Loader
/
!Help
< prev
next >
Wrap
Text File
|
1992-06-13
|
8KB
|
172 lines
> <Loader$Dir>.!Help
!Loader - a file loading utility
================================
NB By default, the icon on the icon bar has a clock underneath it. If you
don't like this, open the directory by double-clicking on !Loader with
<shift> held down, edit the !Run file and put the string "noclock" after the
"Run <Loader$Dir>.!RunImage" command. For the more adventurous, you can
change the format of the clock by editing the string "format$" near the top
of !RunImage; you should also set "format_length%" to the maximum number of
displayed characters.
This is a really simple program, but it fulfils a long felt want (at least
for me). RISC OS allows you to set a run action for each file type, so that
you can specify what happens when you double click on a file (which causes
the Filer to *Run the file). You can also specify a load action for the
*Load command, but from the desktop there's no way to trigger a load.
However, when you double click, before issuing a *Run the filer sends a
DataOpen message to all of the running applications to give them a chance to
load the file, rather than starting a new copy of the application. !Loader
just picks up this message, and looks to see if the shift key is held down.
If it is it triggers a *Load; otherwise it passes the message on. As an
added bonus, you can also set an AltType variable (analagous to RunType and
LoadType) with a string which is used if you hold down the alt key instead.
Before issuing the load command the system variable Loader$FileDir is set
to the path name of the directory containing the clicked file. This can then
be used in the LoadType alias, e.g. with "Dir |<Loader$FileDir>" (the
vertical bar is important!). The file name is, of course, directly available
to the alias as argument 0, but is also put into the variable Loader$File.
The full Load (or @AltType...) command is also put into Alias$Loader_Load,
so you can just type Loader_Load at the command line to re-load the same
file (note that you can do this even after quitting !Loader). This is done
automatically if you click with <adjust> on the *L icon.
Clicking with <select> on the icon does the equivalent of *Load'ing an
empty BASIC file. For the technically minded, it does "@LoadType_FFB null:".
This actually generates a "file not found" error, but you don't see it as
entering the editor clears the screen, and it does guarantee that the file
name won't match anything. I feel a file load from null: should really just
return EOF rather than an error; that's how it works on a VAX!
A "load" of a directory sets it as the current directory (I was a bit
surprised to discover that the Filer broadcasts a DataOpen for directories,
and doesn't open them if it's claimed). A "load" with <alt> sets the parent
of the clicked directory as current.
The !Boot file of the application has some sample definitions; it does a
*ScreenLoad for sprite files, loads data, obey and exec files into !Edit
(but see below), and loads BASIC files into the BASIC editor (so no need for
all these front ends for the editor!). The load type for text files is set
to *DisplayText for use with the Archimedes World text display module. It
also has AltTypes set to *Type Obey, Exec and Text files, and do
*IconSprites on a sprite file.
Note that if the load/alt type is not set for the file type an error
message is generated, and the file is not run.
There are a couple of defects to this system. Firstly, if another
application is already loaded it may see the DataOpen message and act on it
before !Loader gets a look in. To get around this you can drag the file
directly onto the *L icon, and it will then be loaded (unless you hold the
alt key down, when it will be alt'ed). The second problem occurs if you
have, say, the load type of an obey file set to load the file into !Edit. If
!Edit is already loaded this will try to load a second copy of it, as
there's no general way of convincing a running application to load a file of
a type it doesn't recognise. This isn't really a problem, though, as if the
application is already running you can just drag the file to its icon on the
icon bar.
There is a PD module called ToEdit, which allows you to load a file into a
running copy of !Edit with a shift-double-click, so it provides a
complementary facility. To avoid clashes with this, !Loader accepts <ctrl>
as an alternative to <shift>. <ctrl> always works, but <shift> is disabled
if a module called "ToEdit" is in the module chain. ToEdit doesn't always
seem to work, but I haven't figured out if this is a bug in !Loader or in
ToEdit (or elsewhere - the !Menon hot keys also don't always work).
There are two puzzles to go with this application:
1) If I have !Edit loaded, either before or after !Loader, it ALWAYS claims
the DataOpen for text files, and !Loader never sees it - why not?
2) The proginfo box doesn't seem to be moveable, despite the fact that the
relevant bit is set (and it is moveable in !FormEd). This problem appears
to go away if I add another item to the menu!
I don't know the answers to these, so it's no use asking me!
Finally, the boring bit. This program is FreeWare, but I retain copyright.
You can copy it freely, as long as you don't sell it for profit, and as long
as this file goes with it. If you make any changes (except adding load/alt
types to the !Boot/!Run files), add a comment to that effect in both the
"Program information" box and in this file. You can freely use bits of the
code in your own applications, as long as they are credited to me in any
code that you distribute. I make no warranty for the performance of the
program, fitness for any purpose, or absence of bugs, and I take no
responsibility for files erased, computers blown up, nuclear wars started,
or any other consequence of the use of the program. Basically, I've done the
best I can to make it bug free, but beyond that (as with all PD programs)
you should use it with care.
If you find the program useful you might like to make a donation to Oxfam
- say £5.
I can be contacted by e-mail on Janet (the UK academic network) as
SB2 @ UK.AC.RL.IB, or by snail mail:
Stephen Burke,
c/o 7, Egdon Drive,
Luton,
Beds
LU2 7AZ
-----------------------------------------------------------------------------
Changes:
Version 1.01, 4/8/91.
Various bells and whistles added:
Loader$FileDir variable set to the directory path.
Loader$File set to the file name.
Alias$Loader_Load set to the load command string.
Loader_Load command issued by clicking with <adjust> on the icon.
Clicking with <select> loads a null BASIC file.
LoadType for BASIC files changed to poke the keyboard buffer rather
than *Exec'ing a file - may be better for those without a hard disc!
Also sets the current directory to <Loader$FileDir>. Now you REALLY
don't need a front end for the BASIC editor!
Load type for text files now set to "DisplayText" for use with
ArcWorld module; alt type is now *Type. (I think it's worth buying a
copy of Archimedes World just for this module - only 6.5K used instead
of 160K! ARCFS would be good too, if it didn't crash my SCSI filer ...)
Run file calls !Boot, so only one copy of type definitions needed.
Version 1.02, 17/8/91.
Set current directory if a directory is "loaded".
Bugs fixed - doesn't crash anymore (I hope), and deals correctly with
ToEdit.
Version 1.03, 1/5/92.
Added a clock under the icon.
Version 1.04, 12/6/92.
Made the clock existance and format (semi-) configurable.
Interactive help support added.
Watch out for the all new, module task version, coming soon (?) to a PD
library near you!